var number = parseInt(prompt("输入一个数字！"));
var res = 0;
while(number)
{
  res += number % 10;
  number /= 10;
  number = parseInt(number);
}
prompt(res);